DOORS Connection from WCF Service

Sir, I would like to connect DOORS from my WCF Service.

I have maintain the following procedures.

1. Add reference IBM\Rational\DOORS\9.3\bin\doors.tlb in my project.
2. Then write the following lines:
DoorsTypeLibrary.DoorsDXLClass dxlAPI = new DoorsTypeLibrary.DoorsDXLClass();
string DXLStr = " #include <">;";
// DXLStr="Doors -u \"Administrator\" -P \"ST1PL2\" -b \" oleSetResult #include <D:/Tapas/Downloads/Doors/DXL/test2.dxl>\"";
dxlAPI.runStr(DXLStr);

Getting error Access denied: DOORS session is not authenticated

I can run the same code in Windows Application.

Please help
TapasMondal - Mon Aug 27 00:02:21 EDT 2012

Re: DOORS Connection from WCF Service
Mathias Mamsch - Mon Aug 27 04:01:46 EDT 2012

It seems you are mixing up batch mode and interactive mode and have problems starting DOORS correctly. Try the code from here, if you want to start up an interactive session:

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14463581&#14463581

if (Process.GetProcessesByName("doors").Length == 0) {
   System.Diagnostics.Process proc = new System.Diagnostics.Process();
   proc.StartInfo.FileName= "S:\\Programme\\Telelogic\\DOORS_8.2\\bin\\doors.exe";
   proc.StartInfo.Arguments = "-u Administrator -P ST1PL2";
   proc.StartInfo.UseShellExecute = false; 
   proc.Start();                        
                        
   // Wait for GUI to fire up ...
   proc.WaitForInputIdle();                     
}
                        
DOORSCOMLib.DOORSClass d = new DOORSCOMLib.DOORSClass();                                                
d.runStr("print \"Hallo\"");
// TODO: Implement Functionality Here
                        
Console.Write("Check your DOORS output . . . ");
Console.ReadKey(true);

In the above code, you can use oleSetResult

If you want to use batch mode (which your parameters imply), you do not need the DOORS Type Library. Instead you simply call

doors.exe -W -b filename.dxl -u Administrator -P ST1PL2

In this case you would need to write the result to a file from your DXL script, and read it from the file, so you cannot use oleSetResult in this case. Maybe that helps, regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: DOORS Connection from WCF Service
TapasMondal - Mon Sep 03 00:06:35 EDT 2012

Mathias Mamsch - Mon Aug 27 04:01:46 EDT 2012

It seems you are mixing up batch mode and interactive mode and have problems starting DOORS correctly. Try the code from here, if you want to start up an interactive session:

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14463581&#14463581

if (Process.GetProcessesByName("doors").Length == 0) {
   System.Diagnostics.Process proc = new System.Diagnostics.Process();
   proc.StartInfo.FileName= "S:\\Programme\\Telelogic\\DOORS_8.2\\bin\\doors.exe";
   proc.StartInfo.Arguments = "-u Administrator -P ST1PL2";
   proc.StartInfo.UseShellExecute = false; 
   proc.Start();                        
                        
   // Wait for GUI to fire up ...
   proc.WaitForInputIdle();                     
}
                        
DOORSCOMLib.DOORSClass d = new DOORSCOMLib.DOORSClass();                                                
d.runStr("print \"Hallo\"");
// TODO: Implement Functionality Here
                        
Console.Write("Check your DOORS output . . . ");
Console.ReadKey(true);

In the above code, you can use oleSetResult

If you want to use batch mode (which your parameters imply), you do not need the DOORS Type Library. Instead you simply call

doors.exe -W -b filename.dxl -u Administrator -P ST1PL2

In this case you would need to write the result to a file from your DXL script, and read it from the file, so you cannot use oleSetResult in this case. Maybe that helps, regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Thanks for your reply. This really help me. I used your option 1.

I also tried for option 2(batch mode). This also worked for me. But I need to pass parameter in the dxl file. I am giving my sample.
How can I do this. Please help
string getListOfModules(string projectName)
{
noError()
Project p = project "/" projectName
string ErrMess ="";
string xml=""
xml= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
if( null == p)
{
ErrMess = projectName " Project " "Does nor Exist"
xml = xml "<error>" ErrMess "</error>"
oleSetResult(xml)
return (xml)

halt()

}

Regexp isCurrentProject = regexp "/" projectName "*"
Item item
xml = xml "<entities>\n"
for item in p do
{
// print type(item) "\n"
if(type(item) == "Formal")
{
if(isCurrentProject fullName(item))
{
string entityName = fullName(item)
xml = xml "<entity name=\"" entityName "\"" " description=\"" description(item) "\"></entity>\n"

}
}
}
xml = xml "</entities>"
oleSetResult(xml)

return (xml)
}

Re: DOORS Connection from WCF Service
Mathias Mamsch - Mon Sep 03 03:11:29 EDT 2012

TapasMondal - Mon Sep 03 00:06:35 EDT 2012
Thanks for your reply. This really help me. I used your option 1.

I also tried for option 2(batch mode). This also worked for me. But I need to pass parameter in the dxl file. I am giving my sample.
How can I do this. Please help
string getListOfModules(string projectName)
{
noError()
Project p = project "/" projectName
string ErrMess ="";
string xml=""
xml= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
if( null == p)
{
ErrMess = projectName " Project " "Does nor Exist"
xml = xml "<error>" ErrMess "</error>"
oleSetResult(xml)
return (xml)

halt()

}

Regexp isCurrentProject = regexp "/" projectName "*"
Item item
xml = xml "<entities>\n"
for item in p do
{
// print type(item) "\n"
if(type(item) == "Formal")
{
if(isCurrentProject fullName(item))
{
string entityName = fullName(item)
xml = xml "<entity name=\"" entityName "\"" " description=\"" description(item) "\"></entity>\n"

}
}
}
xml = xml "</entities>"
oleSetResult(xml)

return (xml)
}

What I like to do, is, I make a temporary batch file and write the DXL code for initializing the variables in there. Example:

// test.dxl 
print "Parameter 1: " par1 "\n"
print "Parameter 2: " par2 "\n"
 
// launch.bat
echo string par1 = "Hello " > "%TEMP%\temp.dxl"
echo string par2 = "World!" >> "%TEMP%\temp.dxl"
echo #include ^<%CD:\=/%/test.dxl^> >>%TEMP%\temp.dxl
 
type %TEMP%\temp.dxl
 
%PROGRAMFILES%\IBM\Rational\DOORS\9.3\bin\doors.exe -b "%TEMP%\temp.dxl" -u Administrator

Note the special escaping syntax of the batch file using ^ and to escape the pipe operators, and the %var:a=b% syntax for replacing the backslashes to forwards slashes. If you are doing this from another language you can do this easier, the resulting temporary DXL should look like this:

string par1 = "Hello "
string par2 = "World!"
#include <c:/temp/test.dxl>

which allows passing the two parameters to the batch script. Another possibility is to use the cli statement, to declare the variables at global level:

%PROGRAMFILES%\IBM\Rational\DOORS\9.3\bin\doors.exe -cli "string par1=\"Hello \"; string par2=\"World!\";" -b "test.dxl" -u Administrator


If you have many parameters, then it would probably be better to use the first option instead of trying to put everything into the cli parameter. Hope that helps, regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: DOORS Connection from WCF Service
DastanAli - Wed Aug 03 08:55:38 EDT 2016

TapasMondal - Mon Sep 03 00:06:35 EDT 2012
Thanks for your reply. This really help me. I used your option 1.

I also tried for option 2(batch mode). This also worked for me. But I need to pass parameter in the dxl file. I am giving my sample.
How can I do this. Please help
string getListOfModules(string projectName)
{
noError()
Project p = project "/" projectName
string ErrMess ="";
string xml=""
xml= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
if( null == p)
{
ErrMess = projectName " Project " "Does nor Exist"
xml = xml "<error>" ErrMess "</error>"
oleSetResult(xml)
return (xml)

halt()

}

Regexp isCurrentProject = regexp "/" projectName "*"
Item item
xml = xml "<entities>\n"
for item in p do
{
// print type(item) "\n"
if(type(item) == "Formal")
{
if(isCurrentProject fullName(item))
{
string entityName = fullName(item)
xml = xml "<entity name=\"" entityName "\"" " description=\"" description(item) "\"></entity>\n"

}
}
}
xml = xml "</entities>"
oleSetResult(xml)

return (xml)
}

Hi TapasMondal,

As you mentioned Thanks for your reply. This really help me. I used your option 1.

Did option 1 mentioned by Mathias work for you and resolved error  Access denied: DOORS session is not authenticated, when you call WCF service.

I copied that code into my class and tried executing it.

When I executed it normally, It executed successfully but when I publish web site and try to execute it as a WCF service it still displays me the same error,

Could you please explain how did option 1 mentioned by Mathias worked for you

 

Thanks in advance

Dastan Ali